<template>
    <van-swipe class="my-swipe" :autoplay="3000"    indicator-color="white" >
      <van-swipe-item v-for="(image,index) in state.imglist" :key="index">
        <img :src="image.pic">
      </van-swipe-item>
    </van-swipe>
</template>

<script>
import { onMounted, reactive } from "vue"
import {getBanner} from '../api/index'

export default {
setup(){
  let state=reactive({
    imgList:[]
  });
  onMounted(()=>{
      let res = getBanner(2).then((res)=>{
          state.imglist = res.data.banners; 
        });
			})

  return {
      state,
    }
  }
}
</script>

<style lang="less" scoped>
.my-swipe .van-swipe-item {
    width: 7.1rem;
    height: 2.6rem;
    border-radius: 0.2rem;
    color: #fff;
    font-size: 20px;
    line-height: 150px;
    text-align: center;

    img{
      width: 100%;
      height: auto;
    }
  }
</style>